package com.core.website.api;

import com.core.website.common.Result;
import com.core.website.common.ResultUtil;
import com.core.website.entity.ContentType;
import com.core.website.service.ContentTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/contentTypeApi")
public class ContentTypeApi {
    @Autowired
    private ContentTypeService contentTypeService;
    @PostMapping("/add")
    public Result add(@RequestBody ContentType contentType){
        int result=contentTypeService.add(contentType);
        return ResultUtil.success(result);
    }
    @PostMapping("/edit")
    public Result edit(@RequestBody ContentType contentType){
        int result=contentTypeService.edit(contentType);
        return ResultUtil.success(result);
    }
    @PostMapping("/delete")
    public Result delete(@RequestBody List<String> ids){
        int result=contentTypeService.delete(ids);
        return ResultUtil.success(result);
    }
    @PostMapping("/queryAll")
    public Result queryAll(@RequestBody ContentType contentType){
        List<ContentType> result=contentTypeService.queryAll(contentType);
        return ResultUtil.success(result);
    }
    @GetMapping("/queryOne")
    public Result queryOne(String id){
        ContentType result=contentTypeService.queryOne(id);
        return ResultUtil.success(result);
    }
}
